IF/ THEN/ ELSE logic is fertile ground for figuring out how to use WHERE clause predicates so rows can be rejected sooner in DB2's address space. IF/THEN/ELSE逻辑是搞清楚如何使用WHERE子句谓词的良好基础,因此在DB2地址空间中行能够被快速拒绝。
The solution provided is remarkably simple: you add an extra if statement to the else clause. 提供的解决方案非常简单:给else子句添加一个额外的if语句。
One special feature of the break statement is that it breaks completely out of the loop, thereby skipping any else clause that follows the loop. break语句的一个特殊特性是,它完全中断循环,并跳转到循环下面的任一个else子句。
The else clause is never executed, so nothing is printed out until you explicitly use a separate print statement. else子句永远不被执行,所以直到显式使用print语句之前不会输出任何东西。
At this point, the break statement causes program execution to break out of the while loop, skipping the else clause. 此时,break语句导致程序执行中断while循环,跳转到else子句。
Once the code has iterated over all the elements in the tuple, it enters the else clause of the for loop, which prints out the value of the count variable. 一旦代码已经迭代了tuple中的所有元素,它将进入for循环的else子句,打印count变量的值。
The while loop, as was the case with the if statement, supports an optional else clause containing a block of program statements executed when the expression is False. while循环与if语句一样,支持一个可选的else子句,其中包含一个当表达式计算为False时执行的程序语句块。
The if statement supports an optional else clause that indicates a block of program statements that should be processed if the Boolean expression evaluates False. if语句支持一个可选的else子句,指示当布尔表达式计算为False时应该处理的程序语句块。
Once the code finishes iterating through the tuple, the else clause is invoked, and the running total is printed. 一旦代码完成tuple中的迭代,将调用else子句,打印总和。
Ceylon also ensures ( at compile time) that the switch statement contains an exhaustive list of instance tests or, at a minimum, an else clause to provide complete coverage. Ceylon还确认(在编译时)switch语句包含详尽的实例测试列表,至少包含else子句,从而提供完整的覆盖范围。
Traditionally, the Java language has always made the else clause of an if optional, assuming that you can simply skip the block of code if the condition holds false. 传统上,Java语言对if的else子句的使用是随意的,并且假定如果条件出错,可以只跳过代码块。
Note that there is no need for an else clause, because the page will be returned automatically to the browser and the validation controls will display their own error messages. 请注意,在此无需其他子句,原因是页将自动返回到浏览器,并且验证控件将显示其自己的错误信息。